<include file="public+header">

{script}
<!--
<if condition="empty( $nId )" >
function checkUsername(){

	Dyhb.AjaxSend('{:G::U('user/checkusername')}','ajax=1&user_name='+$('#user_name').val());
}
<else/>
function resetPassword(){

	Dyhb.AjaxSend('{:G::U('user/resetpassword')}','ajax=1&id={$arrValue['user_id']}&password='+$('#resetPassword').val());
}
function update(){

	Dyhb.AjaxSubmit('userAdd','{:G::U('user/update')}');
}
</if>
-->
{/script}

   <!-- 标题  -->
   <div class="title"><if condition="empty( $nId )" ><lang>添加用户</lang><else/><lang>编辑用户</lang></if> ( <a href="{:G::U('user/index')}"><lang>返回用户列表</lang></a> )</div>

  <!-- 正文 -->
  <div id="content" class="content">

  <if condition="isset( $nId ) && !empty( $nId )" >
    <table class="form-table full">
    <tr>
        <th valign="top"><label for="resetPassword"><lang>重置密码</lang>：</label></th>
        <td><input type="text" name="resetPassword" type="password" id="resetPassword" class="field" size="40"  >
            <input type="button" value="<lang>重置密码</lang>" onclick="resetPassword()" class="field">
            <br/><div class="description"><lang>修改用户登录密码，请慎重</lang></div>
        </td>
    </tr>
    </table>
  </if>

     <form action="<if condition="empty( $nId )" >{:G::U('user/insert')}<else/>{:G::U('user/update')}</if>" method="post" id="userAdd" name="userAdd" >
      <table class="form-table full">
          <tr>
            <th valign="top"><label for="user_name"><lang>用户名</lang>：</label></th>
            <td><input type="text" name="user_name" id="user_name" class="field" size="40" <if condition="isset( $arrValue )">disabled="true"</if> value="<if condition="isset( $arrValue )">{$arrValue['user_name']}</if>"/>
            <if condition="empty( $nId )" ><input type="button" value="<lang>检测帐号</lang>" onclick="checkUsername()" class="field"></if>
            <br /><div class="description"><lang>用户名是用于登录网站的唯一帐号，建议没有特别的事请不要修改</lang></div>
            <div class="warning"><lang>户名只能由数字，下划线，字母组成</lang></div>
            </td>
          </tr>
          <if condition="!isset( $nId )" >
          <tr>
            <th valign="top"><label for="user_password"><lang>密码</lang>：</label></th>
            <td><input type="password" name="user_password" id="user_password" class="field" size="40" />
             <br/><div class="description"><lang>密码是用于用户登录系统的必需，进行安全认证</lang></div>
            </td>
          </tr>
          </if>
          <tr>
            <th valign="top"><label for="user_nikename"><lang>昵称</lang>：</label></th>
            <td><input type="text" name="user_nikename" id="user_nikename" class="field" size="40" value="<if condition="isset( $arrValue )">{$arrValue['user_nikename']}</if>"/>
            <br/><div class="description"><lang>昵称是相对于用户的一种身份名字，如admin可以给一个\"管理员\"</lang></div>
            </td>
          </tr>
          <tr>
            <th valign="top"><label for="user_status"><lang>状态</lang>：</label></th>
            <td><SELECT class="field"  name="user_status">
	             <option value="1" <if condition="isset( $arrValue ) && $arrValue['user_status']==1">selected</if>><lang>启用</lang></option>
	             <option value="0" <if condition="!isset( $arrValue ) || ( isset( $arrValue ) && $arrValue['user_status']==0 ) ">selected</if> ><lang>禁用</lang></option>
	           </SELECT>
	           <br/><div class="description"><lang>用户帐号状态，开启后才能够使用</lang></div>
            </td>
          </tr>
          <tr>
            <th valign="top"><label for="user_remark"><lang>备注</lang>：</label></th>
            <td><textarea name="user_remark" id="user_remark" class="field" cols="70" rows="5"><if condition="isset( $arrValue )">{$arrValue['user_remark']}</if></textarea>
            <br/><div class="description"><lang>用户的一些其它信息可以填在这里</lang></div>
            </td>
          </tr>

          </table>
          <p class="center"><if condition="!empty( $nId )" ><input type="hidden" name="ajax" value="1"></if>
          <input type="hidden" name="id" id="id" value="<if condition="!empty( $nId )" >{$nId}</if>"/>
          <input type="<if condition="!empty( $nId )" >button<else/>submit</if>" <if condition="!empty( $nId )" >onclick="update()"<else>onclick="javascript:{this.disabled=true;document.userAdd.submit();}"</if>  class="button" value="<if condition="!empty( $nId )" >  <lang>更  新</lang><else/>  <lang>发  布</lang></if>  " />
          <input type="reset" class="button" value="  <lang>重  置</lang>  " />
        </p>
        </form>

   </div>
   <!-- end content -->

<include file="public+footer">